/**
 * Created by shao-yikun on 2017/4/7.
 */
var modalDT;
var orgId = 0;
var orgDataFlag = 0;
var roadPoleJsonData;
var roadSignCollectFlag = 0;
var fileUrl;
var switchPic = 0;
var provinceAdd = 0,
    cityAdd = 0,
    areaAdd = 0;
var actorId = 3;
if (gUserLoginResult.userActors.indexOf("7") >= 0) actorId = 7;
if (gUserLoginResult.userActors.indexOf("1") >= 0) actorId = 1;
var times = 0;
var startRoad4S = "";
var endRoad4S = "";
var roadName4S = "";
var saveState = "";
var currentActorId = 3;
var localOrgId = 0;
if (gUserLoginResult.userActors.indexOf("7") >= 0) currentActorId = 7;
if (gUserLoginResult.userActors.indexOf("1") >= 0) currentActorId = 1;

var localActorId;

$(function () {
    localActorId = currentActorId;
    localOrgId = gUserLoginResult.orgId;
    gMainDT = $("#mainDataTables").DataTable({
        ajax: {
            url: "../rds_roadSignManageController/getRoadPoleCollect4DT",
            type: "POST",
            data: function (d) {
                d.search = $('#mainDataTables').DataTable().search(this.value);
                d.orgId = localOrgId;
                d.actorIds = localActorId;
                d.startRoad = startRoad4S;
                d.endRoad = endRoad4S;
                d.roadName = roadName4S;
                d.saveState = saveState;
            }
        },
        columns: [{
            data: "roadPoleId",
            render: function (data, type, row, meta) {
                var checkId = "checkbox" + (parseInt(meta.row) + 1);
                return "<input type='checkbox' value='" + data + "' id='" + checkId + "'>";
            }
        }, {
            data: null,
            targets: 0
        }, {
            data: "roadPolePic",
            render: function (data, type, row) {
                return "<img src='" + data + "' style='width:50px;height:40px;cursor: pointer' " +
                    "onclick='$.showPicModal(\"" + data + "\")'> ";
            }
        }, {
            data: "roadPoleId",
            render: function (data, type, row) {
                var str = "<button id='showMap' onclick='$.showMap(" + row.longitude + "," + row.latitude + ")' " +
                    "class='btn  btn-primary  btn-xs btn-flat' title='地图位置'><i class='glyphicon glyphicon-map-marker'></i></button> "
                str += row.province + " " + row.city + " " + row.area;
                return str;
            }
        }, {
            data: "roadName"
        }, {
            data: "roadPoleId",
            render: function (data, type, row) {
                return row.startRoad + "——" + row.endRoad;
            }
        }, {
            data: "roadPoleBridge",
            render: function (data, type, row) {
                var roadPoleBridge = "否";
                if (data == 0)
                    roadPoleBridge = "是";
                return roadPoleBridge;
            }
        }, {
            data: "roadPoleSecurity",
            render: function (data, type, row) {
                var roadPoleSecurity = "安全";
                if (row.roadPoleSecurity != 0) {
                    roadPoleSecurity = "不安全";
                }
                return roadPoleSecurity;
            }
        }, {
            data: "orgName"
        }, {
            data: "userName"
        }, {
            data: "roadPoleCreateTime",
            render: function (data, type, row) {
                return data.substring(0, 10);
            }
        }, {
            data: "roadPoleId",
            render: function (data, type, row) {
                return "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.getRoadSignByRoadPoleIdModal(" + JSON.stringify(row) + ")'>查看标牌</button> " +
                    "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.getAllInformation(" + JSON.stringify(row) + ")' title='预览'>" +
                    "<i class='glyphicon glyphicon-eye-open'></i></button> " +
                    "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.showQrcode(" + JSON.stringify(row) + ")' title='二维码'>" +
                    "<i class='glyphicon glyphicon-qrcode'></i></button>";
            }
        }, {
            data: "roadPoleId",
            render: function (data, type, row) {
                var buttonOperation = "";
                if (row.roadPoleIsComplete == 1)
                    buttonOperation += "<button  class='btn  btn-success btn-xs btn-flat' title='已审核'>" +
                        "<i class='fa  fa-check-square-o'></i></button> ";
                else
                    buttonOperation += "<button  class='btn  btn-danger btn-xs btn-flat' title='未审核'>" +
                        "<i class='fa fa-square-o'></i></button> ";
                var buttonUpdate = "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.updateRoadPoleCollectModal(" + JSON.stringify(row) + ")' title='编辑'>" +
                    "<i class='fa fa-edit'></i></button>";
                var buttonDelete = "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.deleteRoadPoleCollect(" + data + ")' title='删除'>" +
                    "<i class='fa fa-minus-square'></i></button>";
                gUpdate == 0 ? buttonOperation : buttonOperation += buttonUpdate + " ";
                gDelete == 0 ? buttonOperation : buttonOperation += buttonDelete;
                buttonOperation == "" ? buttonOperation = "无权限" : buttonOperation;
                return buttonOperation;
            }
        }],
        dom: "<'row'<'col-md-2'l><'#mainToolbar.col-md-10'>r>t<'row'<'col-md-5'i><'col-md-7'p>>",
        initComplete: function () {
            // 下拉工具栏按钮的权限
            $("#mainToolbar").empty();
            var strToolBar = "<div class='pull-right'><div class='btn-group'>" +
                "<button type='button' class='btn btn-primary btn-sm btn-flat'><i class='fa fa-cog'></i> 操作</button>" +
                "<button type='button' class='btn btn-primary btn-sm btn-flat dropdown-toggle' " +
                "data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>" +
                "<span class='caret'></span><span class='sr-only'>切换下拉</span></button>" +
                "<ul class='dropdown-menu'>" +
                "<li>" +
                "<button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='gMainDT.ajax.reload(null, false);'><i class='fa fa-refresh'></i> 刷新</button>" +
                "</li>";

            var buttonAdd = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='$.addRoadPoleCollectModal()'><i class='fa fa-plus-square'></i> 添加</button></li>";
            gInsert == 0 ? strToolBar : strToolBar += buttonAdd;

            var buttonDelete = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='$.deleteRoadPoleCollect(0)'><i class='fa fa-minus-square'></i> 删除</button></li>";
            gDelete == 0 ? strToolBar : strToolBar += buttonDelete;

            var buttonUpdate = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='$.setRoadPoleMainOrg()' title='设置监管单位'><i class='fa  fa-cog'></i> 监管</button></li>";
            gUpdate == 0 ? strToolBar : strToolBar += buttonUpdate;

            var html2 = "";
            if (currentActorId == 1)
                html2 += "<select id='orgId4Select' style='max-width: 280px' onchange='$.getRoad(1);' class='form-control'>" + gOrgListHtml + "</select>&nbsp;";
            strToolBar += "</ul></div> " +
                "<div class='input-group-sm' style='display:inline-block'>" + html2 +
                "<input id='roadName4S' onkeyup='$getRoad(1);' type='text' class='form-control mysize' placeholder='路名'>" +
                "&nbsp;<select onchange='$.getRoad(2);'  style='width: 80px' class='form-control mysize' id='startRoad4S'>" +
                "<option value=''>起/止</option>" +
                "</select>&nbsp;" +
                "<select class='form-control mysize'  style='width: 80px' id='endRoad4S'>" +
                "<option value=''>止/起</option>" +
                "</select>&nbsp;" +
                "<select id='SaveStateSelect' class='form-control mysize'>" +
                "<option value=''>全部</option>" +
                "<option value='0'>安全</option>" +
                "<option value='1'>不安全</option>" +
                "</select>&nbsp;" +
                "<input type='text' class='form-control' style='width: 80px' id='searchText' placeholder='项目编号'>" +
                "<button class='btn btn-primary btn-flat btn-sm' type='button' onclick='$(this).searchDT()'>" +
                "<i class='fa fa-search'></i></button></div></div>";
            $("#mainToolbar").append(strToolBar);
            $.getRoad(1);//初始化选择框

        },
        processing: true,
        serverSide: true,
        ordering: false,
        select: false,
        autoFill: true,
        displayLength: 20,
        lengthMenu: [[5, 10, 15, 20, 50, 100, 150, -1], [5, 10, 15, 20, 50, 100, 150, "All"]],
        language: {
            url: "zh_cn.json"
        },
        fnDrawCallback: function () {// 序号自增回调函数
            var api = this.api();
            var startIndex = api.context[0]._iDisplayStart;
            api.column(1).nodes().each(function (cell, i) {
                cell.innerHTML = startIndex + i + 1;
            });
        }
    });

    if (gUserLoginResult.orgType == 1) {
        var oTable = $('#mainDataTables').dataTable();
        oTable.fnSetColumnVis(5, false);
    } else {
        var oTable = $('#mainDataTables').dataTable();
        oTable.fnSetColumnVis(8, false);
    }
    if (gUpdate == 0 && gDelete == 0 && gInsert == 0) {
        var oTable = $('#mainDataTables').dataTable();
        oTable.fnSetColumnVis(0, false);//隐藏列
        oTable.fnSetColumnVis(11, false);
    }


});

var gActorId = gUserLoginResult.userActors.includes("1") ? 1 : 2;
$.getOrgList = function () {
    var html = "", result = "";
    $.ajax({
        url: "../rds_fault/getOrg4Select",
        type: "post",
        async: false,
        data: {
            actorId: gActorId,
            orgId: gUserLoginResult.orgId
        },
        success: function (msg) {
            if (msg) {
                if (msg.isSuccess) {
                    var jsonData = msg.jsonData;
                    var orglist = "";
                    if (jsonData.length == 0) {
                        firstOrgId = gUserLoginResult.orgId;
                        result = "<option value='" + gUserLoginResult.orgId + "'>" + gUserLoginResult.orgName + "</option>"
                    }
                    else {

                        for (var i in jsonData) {
                            orglist += "," + jsonData[i].orgId;
                            html += "<option value='" + jsonData[i].orgId + "'>" + jsonData[i].orgName + "</option>"
                        }
                        orglist = orglist.substr(1);
                        if (gActorId == 1) {
                            result += "<option value='-2'>全部</option>" +
                                "<option value='-1'>未设置</option>"
                            firstOrgId = -2;
                        }
                        else {
                            firstOrgId = orglist
                            result += "<option value='" + orglist + "'>全部</option>"
                        }
                        result += html;
                    }

                }

            }
        }
    })
    return result;
}

var gOrgListHtml = $.getOrgList();

$.fn.searchDT = function () {
    roadName4S = $.Trim($("#roadName4S").val(), "g");
    startRoad4S = $("#startRoad4S").val();
    endRoad4S = $("#endRoad4S").val();
    saveState = $("#SaveStateSelect").val();
    localOrgId = $("#orgId4Select").val();
    if (localActorId != 7) {
        if (localOrgId == -2) {
            localActorId = 1;
        } else {
            localActorId = 3;
        }
    }
    if(!localOrgId)
    {
        localOrgId = gUserLoginResult.orgId;
    }
    gMainDT.search($("#searchText").val()).draw();
};

$.checkChange = function () {
    var isChecked = $("#batchCheck").prop('checked');
    $("input:checkbox[id^='checkbox']").prop("checked", isChecked);
};

$.Trim = function (str, is_global) {
    var result;
    result = str.replace(/(^\s+)|(\s+$)/g, "");
    if (is_global.toLowerCase() == "g") {
        result = result.replace(/\s/g, "");
    }
    return result;
};

$.getRoad = function (type) {
    var mOrgId = $("#orgId4Select").val();
    var localOrg = gUserLoginResult.orgId;
    var mActorId = currentActorId;
    if (mActorId != 7) {
        if (mOrgId == -2) {
            mActorId = 1;
        } else if (mOrgId) {
            mActorId = 3;
            localOrg = mOrgId;
        }
    }
    var id = "endRoad4S";
    var url = "../rds_roadSignManageController/getSectionByRoadName";
    var roadName = $("#startRoad4S").find("option:selected").val();
    if (type == 1) {
        url = "../rds_roadSignManageController/getRoadByRoadName";
        roadName = $.Trim($("#roadName4S").val(), "g");
        id = "startRoad4S";
    }
    $.ajax({
        url: url,
        type: "POST",
        data: {
            "roadName": roadName,
            "actorId": mActorId,
            "orgId": localOrg
        },
        success: function (msg) {
            if (msg != null && typeof(msg) != "undefined") {
                if (msg.isSuccess == true) {
                    var roadNames = msg.jsonData;
                    $("#" + id).empty();
                    if (roadNames.length != 0) {
                        // orgDataFlag = 0;
                        $("#" + id).append("<option value=''>起/止</option>");
                        for (var i = 0; i < roadNames.length; i++)
                            $("#" + id).append("<option value='" + roadNames[i] + "'>" +
                                roadNames[i] + "</option>");
                    }
                    else
                        $("#" + id).append("<option>无</option>");
                    if (type == 1) {
                        $.getRoad(2);
                    }
                } else {
                    $.alert("获取监管单位数据失败", 2);
                }
            }
        }
    })
};

function _debounce(fn, delay) {
    var timer
    return function () {
        var context = this
        var args = arguments
        clearTimeout(timer)
        timer = setTimeout(function () {
            fn.apply(context, args)
        }, delay)
    }
}

var $getRoad = _debounce($.getRoad, 1000);

$('#roadPoleSizeUpdate').click(function () {
    $("#roadPoleSizeListUpdate").css("width", $('#roadPoleSizeUpdate').width() + 56);
    $("#roadPoleSizeListUpdate").show();
    $("#roadPoleSizeListUpdate li").hover(function () {
        $("#roadPoleSizeListUpdate li").css("background", "#ffffff").css("color", "#1d1d1d");
        $(this).css("background", "#1674d0").css("color", "#FEFEFE");
        $("#roadPoleSizeUpdate").val($(this).text());
    });
}).blur(function () {
    $("#roadPoleSizeListUpdate").hide();
});

$('#roadPoleSizeAdd').click(function () {
    $("#roadPoleSizeListAdd").css("width", $('#roadPoleSizeAdd').width() + 56);
    $("#roadPoleSizeListAdd").show();
    $("#roadPoleSizeListAdd li").hover(function () {
        $("#roadPoleSizeListAdd li").css("background", "#ffffff").css("color", "#1d1d1d");
        $(this).css("background", "#1674d0").css("color", "#FEFEFE");
        $("#roadPoleSizeAdd").val($(this).text());
    });
}).blur(function () {
    $("#roadPoleSizeListAdd").hide();
});

$('#roadSignInstallTimeModal').datepicker({
    format: 'yyyy-mm-dd',
    autoclose: true,
    todayBtn: 'linked',
    language: 'zh-CN'
});

var roadPoles;
$.setRoadPoleMainOrg = function () {
    var count = $("input:checkbox[id^='checkbox']:checked").length;
    if (count == 0) {
        $.alert("请选择要设置监管单位的标杆", 2);
        return;
    } else {
        roadPoles = "";
        $("input:checkbox[id^='checkbox']:checked").each(function () {
            roadPoles += $(this).val() + ",";
        });
        roadPoles = roadPoles.substring(0, roadPoles.length - 1);
        $.ajax({
            url: "../rds_org/getMainOrgNameAndId",
            dataType: 'json',
            async: false,
            type: "post",
            data: {"orgId": gUserLoginResult.orgId},
            success: function (msg) {
                if (msg != null && typeof (msg) != "undefined") {
                    if (msg.isSuccess == true) {
                        var orgData = msg.jsonData;
                        $("#tbody").empty();
                        var len = orgData.length;
                        if (len != 0) {
                            for (var i = 0; i < len; i++) {
                                $("#tbody").append("<tr>" +
                                    "<td><input type='radio' name='items' value='" + orgData[i].orgId + "'></td>" +
                                    "<td>" + orgData[i].orgName + "</td>" +
                                    "</tr>");
                            }
                            $("#button").show();
                        } else {
                            $("#tbody").append("<tr>" +
                                "<td></td><td>未设置监管单位,请联系管理员设置</td></tr>");
                            $("#button").hide();
                        }
                    }
                }
            }
        });
        $("#modal-setMainOrg").modal({
            backdrop: 'static',
            keyboard: false,
            show: true
        })
    }
};

$("#button").click(function () {
    $('#modal-setMainOrg').hide();

    $.ajax({
        url: "../rds_roadSignManageController/setRoadPoleMainOrg",
        type: "post",
        async: false,
        data: {
            "roadPoleIds": roadPoles,
            "mainOrgId": $("input:radio[name^='items']:checked").val()
        },
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    $.alert("操作成功", 1);
                    $('#modal-setMainOrg').hide();
                    gMainDT.ajax.reload(null, false);
                } else
                    $.alert("操作失败", 2);
            } else
                $.alert("操作失败", 2);

        }
    })
});


$("#myBtn").click(function () {
    $("#modalMapRoad").show();
    $("#startRoad").val($("#startRoadAdd").val());
    $("#endRoad").val($("#endRoadAdd").val());
    var url = "management/roadPoleMap.html";
    var coo = $("#coordinateAdd").val(),
        coordinate,
        type = 1,
        x, y;
    if (coo != "") {
        coordinate = $("#coordinate").val().split(",");
        x = coordinate[0];
        y = coordinate[1];
    }
    else {
        x = $("#cityAdd").find("option:selected").text();
        y = $("#areaAdd").find("option:selected").text();
        type = 0;
    }
    url += "?x=" + x + "&y=" + y + "&z=" + type + "";//通过这种方式传参数
    areaAdd = $("#areaAdd").val();
    $("#myMap").attr("src", url);
    $("#modal-map").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    })
});

$("#myBtnUpdate").click(function () {
    $("#startRoad").val($("#startRoadUpdate").val());
    $("#endRoad").val($("#endRoadUpdate").val());
    var coordinate = $("#coordinate").val().split(",");
    $("#information").hide();
    var url = "management/roadPoleMap.html";
    url += "?x=" + coordinate[0] + "&y=" + coordinate[1] + "&z=1";//通过这种方式传参数
    $("#myMap").attr("src", url);
    $("#modal-map").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    })
});

var X, Y;
$.showMap = function (x, y) {
    X = x;
    Y = y;
    $("#information").show();
    $("#modalMapRoad").hide();
    var url = "management/poleMap.html";
    url += "?x=" + x + "&y=" + y + "&z=1";//通过这种方式传参数
    $("#myMap").attr("src", url);
    $("#modal-map").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    })
};

$("#information").click(function () {
    $.ajax({
        url: "../rds_RoadSignMap/getRoadPoleByXY",
        type: 'post',
        async: false,
        dataType: 'json',
        data: {
            "longitude": X,
            "latitude": Y
        },
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                var jsonData = msg.jsonData[0];
                $.getAllInformation(jsonData);

            } else {
                $.alert("系统错误", 2);
            }
        }
    })
});

//type=1添加 =0编辑 编辑时查看的标牌可能不是自己公司的（系统管理员）
$.getMainOrgNameAndId = function (id, orgId) {
    $.ajax({
        url: "../rds_org/getMainOrgNameAndId",
        type: 'post',
        async: false,
        dataType: 'json',
        data: {
            'orgId': orgId
        },
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    var orgData = msg.jsonData;
                    $("#" + id).empty();
                    if (orgData.length != 0) {
                        orgDataFlag = 0;
                        for (var i = 0; i < orgData.length; i++)
                            $("#" + id).append("<option value='" + orgData[i].orgId + "'>" +
                                orgData[i].orgName + "</option>");
                    }
                    else {
                        orgDataFlag = 1;
                        $("#" + id).append("<option value='" + gUserLoginResult.orgId + "'>" +
                            gUserLoginResult.orgName + "</option>");
                    }
                } else {
                    $.alert("获取监管单位数据失败", 2);
                }
            } else {
                $.alert('系统错误', 2);
            }
        },
        error: function () {
            $.alert("系统错误", 2);
        }
    });
};

$.getRegion = function (id, pid) {
    $.ajax({
        url: "../rds_roadSignManageController/getRegion4Select",
        type: 'post',
        async: false,
        dataType: 'json',
        data: {
            'pid': pid
        },
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    var provinceData = msg.jsonData;
                    $("#" + id).empty();
                    if (provinceData.length != 0) {
                        provinceDataFlag = 0;
                        for (var i = 0; i < provinceData.length; i++)
                            $("#" + id).append("<option value='" + provinceData[i].regionId + "'>" +
                                provinceData[i].regionName + "</option>");
                    }
                    else {
                        provinceDataFlag = 1;
                        $("#" + id).append("<option value='" + gUserLoginResult.regionId + "'>" +
                            gUserLoginResult.regionName + "</option>");
                    }
                } else {
                    $.alert("获取地区列表失败", 2);
                }
            } else {
                $.alert('系统错误', 2);
            }
        },
        error: function () {
            $.alert("系统错误", 2);
        }
    });
};
var historyDt;
$.showHistory = function (roadSignId) {

    historyDt = $("#historyDt").DataTable({
        destroy: true,
        processing: true,
        serverSide: true,
        ordering: false,
        displayLength: 10,
        // autoWidth: false,
        ajax: {
            url: "../rds_roadSignManageController/getHistory4DT",

            type: "POST",
            data: function (d) {
                d.search = $('#historyDt').DataTable().search(this.value);
                d.equipmentId = roadSignId;
                d.equipmentType = 1;
            }
        },
        columns: [{
            data: null
        }, {
            data: "eventType"
        }, {
            data: "operatingTime"
        }, {
            data: "operatingPerson"
        }],
        language: {
            url: "zh_cn.json"
        },
        dom: "<'row'<'col-md-6'><'#addTool.col-md-6'>r>t<'row'<'col-md-5'i><'col-md-7'p>>",
        initComplete: function () {
            $("#addTool").empty();
            var strToolBar = "<div class='input-group input-group-sm'><input type='text' class='form-control' name='searchInfo' id='datepicker' placeholder='操作时间'>";
            strToolBar += "<span class='input-group-btn'><button class='btn btn-primary btn-flat' type='button' onclick='$(this).searchInfoInHistoryDt()'><i class='fa fa-search'></i></button></span></div>";
            $("#addTool").append(strToolBar);
            $("#addTool input[name='searchInfo']").bind('keydown', function (event) {
                if (event.keyCode == "13") {
                    $(this).searchInfoInMappingDt();
                }
            });
            $("#datepicker").datepicker({
                format: "yyyy-mm-dd",
                language: 'zh-CN',
                autoclose: true,
                todayBtn: 'linked'
            });
        },
        fnDrawCallback: function () {// 序号自增回调函数
            var api = this.api();
            var startIndex = api.context[0]._iDisplayStart;
            api.column(0).nodes().each(function (cell, i) {
                cell.innerHTML = startIndex + i + 1;
            });
        }
    });

    $("#history-modal").modal({
        show: true
    });

};


$.fn.searchInfoInHistoryDt = function () {
    var search = $("#addTool input[name='searchInfo']").val().replace(/'/g, '');
    historyDt.search(search).draw();
};

$.getAllInformation = function (jsonData) {
    $("#myDiv").empty();
    $("#address").html(jsonData.province + " " + jsonData.city + " " + jsonData.area + " " + jsonData.roadName + " " + jsonData.startRoad + "起 " + jsonData.endRoad + "止");
    var temp;
    if (jsonData.roadPoleShape == 0)
        temp = "单直杆";
    if (jsonData.roadPoleShape == 1)
        temp = "双直杆";
    if (jsonData.roadPoleShape == 2)
        temp = "单挑杆";
    if (jsonData.roadPoleShape == 3)
        temp = "双挑杆";
    if (jsonData.roadPoleShape == 4)
        temp = "二F杆";
    if (jsonData.roadPoleShape == 5)
        temp = "三F杆";
    if (jsonData.roadPoleShape == 6)
        temp = "门架";
    $("#shape").html(temp);
    if (jsonData.roadPoleSecurity == 0)
        temp = "安全";
    if (jsonData.roadPoleSecurity == 1)
        temp = "不安全";
    $("#security").html(temp);
    if (jsonData.roadPoleBridge == 0)
        temp = "否";
    if (jsonData.roadPoleBridge == 1)
        temp = "是";
    $("#bridge").html(temp);
    $("#projectNo").html("<b>项目编号:</b>" + jsonData.projectNumber);
    $("#create").html(jsonData.userName);
    $("#size").html(jsonData.roadPoleSize);
    $("#company").html(jsonData.orgName);
    $("#mainOrg").html(jsonData.mainOrgName);
    $.ajax({
        url: "../rds_roadSignManageController/getRoadSignCollect",
        type: 'post',
        async: false,
        dataType: 'json',
        data: {
            'roadPoleId': jsonData.roadPoleId
        },
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    var Data = msg.jsonData;
                    for (var i = 0; i < Data.length; i++) {
                        var data = Data[i];
                        var roadSignLight;
                        var roadSignShape;
                        var roadSignInstallType;
                        var roadSignMaterial;
                        var roadSignDirection;
                        var roadSignType;
                        var roadSignBug;
                        var roadSignSize = data.roadSignSize;
                        var environment = "日常使用";
                        if (data.environment == 1)
                            environment = "施工配合";
                        var roadSignFixed = "扎带";
                        if (data.roadSignFixed == 1)
                            roadSignFixed = "抱箍";
                        var roadSignSecurity = "安全";
                        if (data.roadSignSecurity != 0) {
                            roadSignSecurity = "不安全";
                        }

                        switch (data.roadSignInstallType) {
                            case 0:
                                roadSignInstallType = "单标志";
                                break;
                            case 1:
                                roadSignInstallType = "合杆";
                                break;
                            case 2:
                                roadSignInstallType = "借杆";
                                break;
                        }
                        switch (data.roadSignLight) {
                            case 0:
                                roadSignLight = "反光";
                                break;
                            case 1:
                                roadSignLight = "发光";
                                break;
                            case 2:
                                roadSignLight = "照明";
                                break;
                        }
                        switch (data.roadSignMaterial) {
                            case 0:
                                roadSignMaterial = "铝板";
                                break;
                            case 1:
                                roadSignMaterial = "塑料板";
                                break;
                            case 2:
                                roadSignMaterial = "其它";
                                break;

                        }
                        switch (data.roadSignShape) {
                            case 0: {
                                roadSignShape = "圆形";
                                break;
                            }
                            case 1: {
                                roadSignShape = "八角形";
                                break;
                            }
                            case 2: {
                                roadSignShape = "正三角";
                                break;
                            }
                            case 3: {
                                roadSignShape = "倒三角";
                                break;
                            }
                            case 4: {
                                roadSignShape = "矩形";
                                break;
                            }
                            case 5: {
                                roadSignShape = "方形";
                                break;
                            }
                        }
                        switch (data.roadSignDirection) {
                            case 0:
                                roadSignDirection = "东";
                                break;
                            case 1:
                                roadSignDirection = "南";
                                break;
                            case 2:
                                roadSignDirection = "西";
                                break;
                            case 3:
                                roadSignDirection = "北";
                                break;
                        }
                        switch (data.roadSignType) {
                            case 0:
                                roadSignType = "警告标志";
                                break;
                            case 1:
                                roadSignType = "禁令标志";
                                break;
                            case 2:
                                roadSignType = "指示标志";
                                break;
                            case 3:
                                roadSignType = "指路标志";
                                break;
                            case 4:
                                roadSignType = "旅游标志";
                                break;
                            case 5:
                                roadSignType = "辅助标志";
                                break;
                            case 6:
                                roadSignType = "作业标志";
                                break;
                            case 7:
                                roadSignType = "告示标志";
                                break;
                        }
                        switch (data.roadSignBug) {
                            case 0:
                                roadSignBug = "正常";
                                break;
                            case 1:
                                roadSignBug = "膜脱落";
                                break;
                            case 2:
                                roadSignBug = "膜淡化";
                                break;
                            case 3:
                                roadSignBug = "逆反射系数不达标";
                                break;
                            case 4:
                                roadSignBug = "卷边";
                                break;
                            case 5:
                                roadSignBug = "转向";
                                break;
                            case 6:
                                roadSignBug = "非国际";
                                break;
                            case 7:
                                roadSignBug = "抱箍缺少";
                                break;
                            case 8:
                                roadSignBug = "净空高不达标";
                                break;
                            case 9:
                                roadSignBug = "设置不合理";
                                break;
                            case 10:
                                roadSignBug = "缺失";
                                break;
                            case 11:
                                roadSignBug = "建议增设";
                                break;
                            case 12:
                                roadSignBug = "与交通组织矛盾";
                                break;
                            case 13:
                                roadSignBug = "内容有误";
                                break;
                            case 14:
                                roadSignBug = "标牌与标杆不配套";
                                break;
                            case 15:
                                roadSignBug = "非公指示牌";
                                break;
                        }
                        var n = i + 1;
                        var html = "<table class=\"table table-bordered table-striped\">\n" +
                            "                        <tr>\n" +
                            "                            <th><b>标牌" + n + "</b></th>";
                        if (data.roadSignIsComplete == 0) {
                            html += "                            <th><button type='button' class='btn btn-danger btn-xs btn-flat' >" +
                                "未审核</button></th>";
                        } else {
                            html += "                            <th><button type='button' class='btn btn-default btn-xs btn-flat' >" +
                                "已审核</button></th>";
                        }
                        html += "<th><button type='button' class='btn btn-primary btn-xs btn-flat' onclick='$.showHistory(" + data.roadSignId + ")' >事件历史</button></th>"
                        html += "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td  rowspan=\"8\" colspan=\"3\"><img  onclick=\"$.showPicModal('" + data.roadSignPic + "')\" style=\"width: 230px;height:270px;cursor:pointer\" src=\"" + data.roadSignPic + "\"></td>\n" +
                            "                            <td><b>标志分类：</b></td>\n" +
                            "                            <td>" + roadSignType + "</td>\n" +
                            "                            <td><b>标志含义:</b></td>\n" +
                            "                            <td>" + roadSignType.substring(0, 1) + "" + data.roadSignMeaning + "</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>存在问题:</b></td>\n" +
                            "                            <td>" + roadSignBug + "</td>\n" +
                            "                            <td><b>安全状况:</b></td>\n" +
                            "                            <td>" + roadSignSecurity + "</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>标志形状:</b></td>\n" +
                            "                            <td>" + roadSignShape + "</td>\n" +
                            "                            <td><b>标牌尺寸:</b></td>\n" +
                            "                            <td>" + roadSignSize + "</td>\n" +
                            "\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>标志材料:</b></td>\n" +
                            "                            <td>" + roadSignMaterial + "</td>\n" +
                            "                            <td><b>采集人 :</b></td>\n" +
                            "                            <td>" + data.userName + "</td>\n" +
                            "\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>光源显示:</b></td>\n" +
                            "                            <td>" + roadSignLight + "</td>\n" +
                            "                            <td><b>安装方式:</b></td>\n" +
                            "                            <td>" + roadSignInstallType + "</td>\n" +
                            "\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>固定方式:</b></td>\n" +
                            "                            <td>" + roadSignFixed + "</td>\n" +
                            "                            <td><b>安装日期:</b></td>\n" +
                            "                            <td>" + data.roadSignInstallTime + "</td>\n" +
                            "\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>安装公司:</b></td>\n" +
                            "                            <td>" + data.installOrg + "</td>\n" +
                            "                            <td><b>使用场景:</b></td>\n" +
                            "                            <td>" + environment + "</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>保修期 :</b></td>\n" +
                            "                            <td>" + data.defectsLiabilityPeriod + "年</td>\n" +
                            "                            <td><b>使用年限:</b></td>\n" +
                            "                            <td>" + data.serviceLife + "年</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                            <td><b>标志朝向:</b></td>\n" +
                            "                            <td>" + roadSignDirection + "</td>\n" +
                            "                            <td><b>备注说明:</b></td>\n" +
                            "                            <td colspan=\"7\">" + data.roadSignRemark + "</td>\n" +
                            "                        </tr>\n" +
                            "                        <tr>\n" +
                            "                        </table>";
                        $("#myDiv").append(html);
                    }
                } else {
                    $.alert("数据操作失败", 2);
                }
            } else {
                $.alert('系统错误，请联系管理员', 2);
            }
        }
    });


    $("#img").attr("src", jsonData.roadPolePic);
    $("#img").click(function () {
        $.showPicModal($(this).attr("src"));
    });
    $("#modal-AllInformation").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

$.updateRoadPoleCollectModal = function (jsonData) {
    switchPic = 0;
    $("#projectNumberUpdate").val(jsonData.projectNumber);
    $.getMainOrgNameAndId("mainOrgIdUpdate", jsonData.orgId);
    $("#roadPoleIdUpdate").val(jsonData.roadPoleId);
    $("#provinceUpdate").val(jsonData.province);
    $("#cityUpdate").val(jsonData.city);
    var pid = jsonData.roadPoleRegionId.toString();
    $.getRegion("areaUpdate", pid.substring(0, 4) + "00");
    $("#areaUpdate").val(pid);
    $("#orgIdUpdate").val(jsonData.orgName);
    $("#createUserNameUpdate").val(jsonData.userName);
    $("#coordinate").val(jsonData.longitude + "," + jsonData.latitude);
    $("#roadNameUpdate").val(jsonData.roadName);
    $("#startRoadUpdate").val(jsonData.startRoad);
    $("#endRoadUpdate").val(jsonData.endRoad);
    if (orgDataFlag == 0)
        $("#mainOrgIdUpdate").val(jsonData.mainOrgId);
    else
        $("#mainOrgIdUpdate").val(gUserLoginResult.orgId);
    $("#roadPolePicUpdate").attr("src", jsonData.roadPolePic);
    $("#roadPoleSecurityUpdate").val(jsonData.roadPoleSecurity);
    $("#roadPoleBridgeUpdate").val(jsonData.roadPoleBridge);
    $("#roadPoleShapeUpdate").val(jsonData.roadPoleShape);
    $("#roadPoleSizeUpdate").val(jsonData.roadPoleSize);
    $.changeRoadPoleSizeUpdate();
    $("#updateRoadPoleCollectLabel").text("编辑标杆信息");
    $("#updateRoadPoleCollectModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

$.changeRoadPoleSizeUpdate = function () {
    $("#roadPoleSizeListUpdate").empty();
    switch ($("#roadPoleShapeUpdate").val()) {
        case '0':
            $("#roadPoleSizeListUpdate").append("<li>直径*高度: 80*1000</li>");
            $("#roadPoleSizeListUpdate").append("<li>直径*高度: 80*1500</li>");
            $("#roadPoleSizeListUpdate").append("<li>直径*高度: 80*2000</li>");
            break;
        case '1':
            $("#roadPoleSizeListUpdate").append("<li>直径*高度: 80*1000</li>");
            $("#roadPoleSizeListUpdate").append("<li>直径*高度: 80*1500</li>");
            $("#roadPoleSizeListUpdate").append("<li>直径*高度: 80*2000</li>");
            break;
        case '2':
            $("#roadPoleSizeListUpdate").append("<li>挑臂长*高度: 300*5500</li>");
            break;
        case '3':
            $("#roadPoleSizeListUpdate").append("<li>挑臂长*高度: 300*1500</li>");
            $("#roadPoleSizeListUpdate").append("<li>挑臂长*高度: 300*2500</li>");
            $("#roadPoleSizeListUpdate").append("<li>挑臂长*高度: 300*5500</li>");
            break;
        case '4':
            $("#roadPoleSizeListUpdate").append("<li>挑臂长*高度: 300*5500</li>");
            break;
        case '5':
            $("#roadPoleSizeListUpdate").append("<li>挑臂长*高度: 300*5500</li>");
            break;
        case '6':
            $("#roadPoleSizeListUpdate").append("<li>跨度*高度: 300*5500</li>");
            break;
    }
};

$("#roadPoleShapeUpdate").change(function () {
    $.changeRoadPoleSizeUpdate();
    $("#roadPoleSizeUpdate").val($("#roadPoleSizeListUpdate").children()[0].innerHTML);
});

$('#updateRoadPoleCollectForm').bootstrapValidator({
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        projectNumber: {
            validators: {
                stringLength: {max: 50, message: '项目编号长度不超过50'}
            }
        },
        areaUpdate: {
            validators: {
                notEmpty: {message: '区/县名不能为空'},
                stringLength: {max: 50, message: '区/县名长度不超过50'}
            }
        },
        coordinate: {
            validators: {
                notEmpty: {message: '经纬度不能为空'},
                stringLength: {max: 20, message: '经纬度长度不超过20'}
            }
        },
        roadNameUpdate: {
            validators: {
                notEmpty: {message: '路名不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        startRoadUpdate: {
            validators: {
                notEmpty: {message: '起始路口不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        endRoadUpdate: {
            validators: {
                notEmpty: {message: '结束路口不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        roadPoleSecurityUpdate: {
            validators: {
                notEmpty: {message: '安全状况不能为空'}
            }
        },
        roadPoleBridgeUpdate: {
            validators: {
                notEmpty: {message: '是否桥上不能为空'}
            }
        },
        mainOrgIdUpdate: {
            validators: {
                notEmpty: {message: '监管单位不能为空'}
            }
        },
        roadPoleShapeUpdate: {
            validators: {
                notEmpty: {message: '标杆形状不能为空'}
            }
        },
        roadPoleSizeUpdate: {
            validators: {
                stringLength: {max: 50, message: '标杆大小长度不超过50'}
            }
        }
    }
}).on('success.form.bv', function (e) {
    var coordinate = $("#coordinate").val().split(",");
    e.preventDefault();
    if ($("#projectNumberUpdate").val() == null || $("#projectNumberUpdate").val().length == 0)
        $("#projectNumberUpdate").val(" ");
    $.ajax({
        url: "../rds_roadSignManageController/updateRoadPoleCollect",
        type: 'post',
        data: {
            projectNumber: $("#projectNumberUpdate").val(),
            modifierId: gUserLoginResult.userId,
            roadPoleId: $("#roadPoleIdUpdate").val(),
            area: $("#areaUpdate").find("option:selected").text(),
            longitude: coordinate[0],
            latitude: coordinate[1],
            roadName: $("#roadNameUpdate").val(),
            startRoad: $("#startRoadUpdate").val(),
            endRoad: $("#endRoadUpdate").val(),
            mainOrgId: $("#mainOrgIdUpdate").val(),
            roadPoleSecurity: $("#roadPoleSecurityUpdate").val(),
            roadPoleBridge: $("#roadPoleBridgeUpdate").val(),
            roadPoleShape: $("#roadPoleShapeUpdate").val(),
            roadPoleSize: $("#roadPoleSizeUpdate").val(),
            roadPolePic: $("#roadPolePicUpdate").attr("src"),
            roadPoleRegionId: $("#areaUpdate").val()
        },
        dataType: 'json',
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    $.alert("数据操作成功", 1);
                    $.clearModal($("#updateRoadPoleCollectForm"), $("#updateRoadPoleCollectModal"));
                    gMainDT.ajax.reload(null, false);
                } else {
                    $.alert("数据操作失败", 2);
                }
            } else {
                $.alert('系统错误，请联系管理员', 2);
            }
        },
        error: function () {
            $.alert('系统错误，请联系管理员', 2);
        }
    });
    $('#updateRoadPoleCollectModal').modal('hide');
});

$.addRoadPoleCollectModal = function () {
    $("#information").hide();
    $.clearModal($("#addRoadPoleCollectForm"), $("#addRoadPoleCollectModal"))
    switchPic = 1;
    $.getRegion("provinceAdd", 0);
    if (provinceAdd == 0)
        $("#provinceAdd").val(330000);
    else
        $("#provinceAdd").val(provinceAdd);
    $.getRegion("cityAdd", $("#provinceAdd").val());
    if (cityAdd == 0)
        $("#cityAdd").val(330200);
    else
        $("#cityAdd").val(cityAdd);
    $.getRegion("areaAdd", $("#cityAdd").val());
    if (areaAdd == 0)
        $("#areaAdd").val(330211);
    else
        $("#areaAdd").val(areaAdd);
    $.getMainOrgNameAndId("mainOrgIdAdd", gUserLoginResult.orgId);
    $("#orgIdAdd").val(gUserLoginResult.orgName);
    $("#createUserNameAdd").val(gUserLoginResult.userName);
    $("#roadPolePicAdd").attr("src", "../images/default_photo.png");
    $("#roadPoleSecurityAdd").val(0);
    $("#roadPoleBridgeAdd").val(0);
    $("#roadPoleShapeAdd").val(0);
    $("#roadPoleSizeAdd").val("直径*高度: 80*1000");
    $.changeRoadPoleSizeAdd();
    $("#addRoadPoleCollectLabel").text("添加标杆信息");
    $("#addRoadPoleCollectModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

$("#provinceAdd").change(function () {
    provinceAdd = $("#provinceAdd").val();
    $.getRegion("cityAdd", $("#provinceAdd").val());
    $("#cityAdd").val(parseInt($("#provinceAdd").val()) + 100);
    cityAdd = $("#cityAdd").val();
    $.getRegion("areaAdd", $("#cityAdd").val());
    $("#areaAdd").val(parseInt($("#cityAdd").val()) + 1);
    areaAdd = $("#areaAdd").val();
});

$("#cityAdd").change(function () {
    cityAdd = $("#cityAdd").val();
    $.getRegion("areaAdd", $("#cityAdd").val());
    $("#areaAdd").val(parseInt($("#cityAdd").val()) + 1);
    areaAdd = $("#areaAdd").val();

});

$("#areaAdd").change(function () {
    areaAdd = $("#areaAdd").val();

});


$("#subBtn").click(function () {
    $("#startRoadAdd").val($("#startRoad").val());
    $("#endRoadAdd").val($("#endRoad").val());
    $("#startRoadUpdate").val($("#startRoad").val());
    $("#endRoadUpdate").val($("#endRoad").val());
    $.clearModal($('#form-map'), $('#modal-map'));
    $("#coordinateAdd").val(sessionStorage.getItem("x") + "," + sessionStorage.getItem("y"));
    $("#coordinate").val(sessionStorage.getItem("x") + "," + sessionStorage.getItem("y"));
    $("#roadNameAdd").val(sessionStorage.getItem("roadName"));
    $("#roadNameUpdate").val(sessionStorage.getItem("roadName"));

});

$.changeRoadPoleSizeAdd = function () {
    $("#roadPoleSizeListAdd").empty();
    switch ($("#roadPoleShapeAdd").val()) {
        case '0':
            $("#roadPoleSizeListAdd").append("<li>直径*高度: 80*1000</li>");
            $("#roadPoleSizeListAdd").append("<li>直径*高度: 80*1500</li>");
            $("#roadPoleSizeListAdd").append("<li>直径*高度: 80*2000</li>");
            break;
        case '1':
            $("#roadPoleSizeListAdd").append("<li>直径*高度: 80*1000</li>");
            $("#roadPoleSizeListAdd").append("<li>直径*高度: 80*1500</li>");
            $("#roadPoleSizeListAdd").append("<li>直径*高度: 80*2000</li>");
            break;
        case '2':
            $("#roadPoleSizeListAdd").append("<li>挑臂长*高度: 300*5500</li>");
            break;
        case '3':
            $("#roadPoleSizeListAdd").append("<li>挑臂长*高度: 300*1500</li>");
            $("#roadPoleSizeListAdd").append("<li>挑臂长*高度: 300*2500</li>");
            $("#roadPoleSizeListAdd").append("<li>挑臂长*高度: 300*5500</li>");
            break;
        case '4':
            $("#roadPoleSizeListAdd").append("<li>挑臂长*高度: 300*5500</li>");
            break;
        case '5':
            $("#roadPoleSizeListAdd").append("<li>挑臂长*高度: 300*5500</li>");
            break;
        case '6':
            $("#roadPoleSizeListAdd").append("<li>跨度*高度: 300*5500</li>");
            break;
    }
};

$("#roadPoleShapeAdd").change(function () {
    $.changeRoadPoleSizeAdd();
    $("#roadPoleSizeAdd").val($("#roadPoleSizeListAdd").children()[0].innerHTML);
});

$.changeRoadSignSize = function () {
    $("#roadSignSizeList").empty();
    switch ($("#roadSignShapeModal").val()) {
        case '0':
            $("#roadSignSizeList").append("<li>直径: 600mm</li>");
            $("#roadSignSizeList").append("<li>直径: 800mm</li>");
            $("#roadSignSizeList").append("<li>直径: 1000mm</li>");
            $("#roadSignSizeList").append("<li>直径: 1100mm</li>");
            $("#roadSignSizeList").append("<li>直径: 1200mm</li>");
            $("#roadSignSizeList").append("<li>直径: 其他</li>");
            break;
        case '1':
            $("#roadSignSizeList").append("<li>变长: 300mm</li>");
            $("#roadSignSizeList").append("<li>直径: 其他</li>");
            break;
        case '2':
            $("#roadSignSizeList").append("<li>直径: 700mm</li>");
            $("#roadSignSizeList").append("<li>直径: 900mm</li>");
            $("#roadSignSizeList").append("<li>直径: 1100mm</li>");
            break;
        case '3':
            $("#roadSignSizeList").append("<li>直径: 700mm</li>");
            $("#roadSignSizeList").append("<li>直径: 900mm</li>");
            $("#roadSignSizeList").append("<li>直径: 1100mm</li>");
            break;
        case '4':
            $("#roadSignSizeList").append("<li>长*宽: 2400*1200mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 3000*2000mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 3500*2000mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 4000*2000mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 4000*2200mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 4000*2400mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 5000*2500mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 其他</li>");
            break;
        case '5':
            $("#roadSignSizeList").append("<li>长*宽: 600*600mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 800*800mm</li>");
            $("#roadSignSizeList").append("<li>长*宽: 其他</li>");
            break;
    }
    $("#roadSignSizeModal").val($("#roadSignSizeList").children()[0].innerHTML)
};
var i = 0;
$("#roadSignShapeModal").change(function () {
    $.changeRoadSignSize();
});

$('#roadSignSizeModal').click(function () {
    $("#roadSignSizeList").css("width", $('#roadSignSizeModal').width() + 56);
    $("#roadSignSizeList").show();
    $("#roadSignSizeList li").hover(function () {
        $("#roadSignSizeList li").css("background", "#ffffff").css("color", "#1d1d1d");
        $(this).css("background", "#1674d0").css("color", "#FEFEFE");
        $("#roadSignSizeModal").val($(this).text());
    });
}).blur(function () {
    $("#roadSignSizeList").hide();
});


$('#addRoadPoleCollectForm').bootstrapValidator({
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        projectNumber: {
            validators: {
                stringLength: {max: 50, message: '项目编号长度不超过50'}
            }
        },
        provinceAdd: {
            validators: {
                notEmpty: {message: '省名不能为空'},
                stringLength: {max: 50, message: '省名长度不超过50'}
            }
        },
        cityAdd: {
            validators: {
                notEmpty: {message: '市名不能为空'},
                stringLength: {max: 50, message: '市名长度不超过50'}
            }
        },
        areaAdd: {
            validators: {
                notEmpty: {message: '区/县名不能为空'},
                stringLength: {max: 50, message: '区/县名长度不超过50'}
            }
        },
        coordinateAdd: {
            validators: {
                notEmpty: {message: '经纬度不能为空'},
                stringLength: {max: 20, message: '经纬度长度不超过20'}
            }
        },
        roadNameAdd: {
            validators: {
                notEmpty: {message: '路名不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        startRoadAdd: {
            validators: {
                notEmpty: {message: '起始路口不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        endRoadAdd: {
            validators: {
                notEmpty: {message: '结束路口不能为空'},
                stringLength: {max: 50, message: '路名长度不超过50'}
            }
        },
        roadPoleSecurityAdd: {
            validators: {
                notEmpty: {message: '安全状况不能为空'}
            }
        },
        roadPoleBridgeAdd: {
            validators: {
                notEmpty: {message: '是否桥上不能为空'}
            }
        },
        mainOrgIdAdd: {
            validators: {
                notEmpty: {message: '监管单位不能为空'}
            }
        },
        roadPoleShapeAdd: {
            validators: {
                notEmpty: {message: '标杆形状不能为空'}
            }
        },
        roadPoleSizeAdd: {
            validators: {
                stringLength: {max: 50, message: '标杆大小长度不超过50'}
            }
        }
    }
}).on('success.form.bv', function (e) {
    e.preventDefault();
    var coordinateAdd = $("#coordinateAdd").val().split(",");
    if ($("#projectNumber").val() == null || $("#projectNumber").val().length == 0)
        $("#projectNumber").val("");
    $.ajax({
        url: "../rds_roadSignManageController/addRoadPoleCollect",
        type: 'post',
        data: {
            projectNumber: $("#projectNumber").val(),
            roadPoleId: $("#roadPoleIdAdd").val(),
            province: $("#provinceAdd").find("option:selected").text(),
            city: $("#cityAdd").find("option:selected").text(),
            area: $("#areaAdd").find("option:selected").text(),
            orgId: gUserLoginResult.orgId,
            createUserId: gUserLoginResult.userId,
            longitude: coordinateAdd[0],
            latitude: coordinateAdd[1],
            roadName: $("#roadNameAdd").val(),
            startRoad: $("#startRoadAdd").val(),
            endRoad: $("#endRoadAdd").val(),
            mainOrgId: $("#mainOrgIdAdd").val(),
            roadPoleSecurity: $("#roadPoleSecurityAdd").val(),
            roadPoleBridge: $("#roadPoleBridgeAdd").val(),
            roadPoleShape: $("#roadPoleShapeAdd").val(),
            roadPoleSize: $("#roadPoleSizeAdd").val(),
            roadPolePic: $("#roadPolePicAdd").attr("src"),
            roadPoleRegionId: $("#areaAdd").val()
        },
        dataType: 'json',
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    $.alert("数据操作成功", 1);
                    gMainDT.ajax.reload(null, false);
                } else {
                    $.alert("数据操作失败", 2);
                }
            } else {
                $.alert('系统错误，请联系管理员', 2);
            }
        },
        error: function () {
            $.alert('系统错误，请联系管理员', 2);
        }
    });
    $.clearModal($("#addRoadPoleCollectForm"), $("#addRoadPoleCollectModal"));
});

$.deleteRoadPoleCollect = function (roadPoleIds) {
    var count = 1;
    if (roadPoleIds == 0) {
        count = $("input:checkbox[id^='checkbox']:checked").length;
        if (count == 0) {
            $.alert("请选择要删除的数据", 2);
            return;
        } else {
            roadPoleIds = "";
            $("input:checkbox[id^='checkbox']:checked").each(function () {
                roadPoleIds += $(this).val() + ",";
            });
            roadPoleIds = roadPoleIds.substring(0, roadPoleIds.length - 1);
        }
    }
    bootbox.confirm({
        buttons: {
            confirm: {
                label: '<i class="fa fa-check"></i> 确定',
                className: 'btn btn-primary btn-flat'
            },
            cancel: {
                label: '<i class="fa fa-close"></i> 取消',
                className: 'btn btn-warning btn-flat pull-left'
            }
        },
        message: '<i class="fa fa-question-circle-o"></i> <b class="customer-title">确定删除该' + count + '条数据吗?</b>',
        callback: function (result) {
            if (result) {
                $.ajax({
                    url: '../rds_roadSignManageController/deleteRoadPoleCollect',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        "roadPoleIds": roadPoleIds
                    },
                    success: function (msg) {
                        if (msg != null && typeof (msg) != "undefined") {
                            if (msg.isSuccess == true) {
                                if (msg.jsonData == 0) {
                                    $.alert("数据删除成功", 1);
                                    gMainDT.ajax.reload(null, false);
                                } else {
                                    $.alert("数据删除失败，请先删除本标杆上的标牌", 2);
                                }
                            } else {
                                $.alert("数据删除失败", 2);
                            }
                        } else {
                            $.alert('系统错误，请联系管理员', 2);
                        }
                    },
                    error: function () {
                        $.alert('系统错误，请联系管理员', 2);
                    }
                });
            }
        }
    });
};

$.getRoadSignByRoadPoleIdModal = function (jsonData) {
    roadPoleJsonData = jsonData;
    modalDT = $("#modalDataTables").DataTable({
        ajax: {
            url: "../rds_roadSignManageController/getRoadSignCollect4DT",
            type: "POST",
            data: function (d) {
                d.search = $('#modalDataTables').DataTable().search(this.value);
                d.roadPoleId = jsonData.roadPoleId;
            }
        },
        columns: [{
            data: "roadSignId",
            render: function (data, type, row, meta) {
                var checkId = "modalCheckbox" + (parseInt(meta.row) + 1);
                return "<input type='checkbox' value='" + data + "' id='" + checkId + "'>";
            }
        }, {
            data: null,
            targets: 0
        }, {
            data: "roadSignPic",
            render: function (data, type, row) {
                return "<img src='" + data + "' style='width:50px;height:40px;cursor: pointer' " +
                    "onclick='$.showPicModal(\"" + data + "\")'> ";
            }
        }, {
            data: "roadSignType",
            render: function (data, type, row) {
                var roadSignType = "";
                switch (data) {
                    case 0:
                        roadSignType = "警告标志";
                        break;
                    case 1:
                        roadSignType = "禁令标志";
                        break;
                    case 2:
                        roadSignType = "指示标志";
                        break;
                    case 3:
                        roadSignType = "指路标志";
                        break;
                    case 4:
                        roadSignType = "旅游标志";
                        break;
                    case 5:
                        roadSignType = "辅助标志";
                        break;
                    case 6:
                        roadSignType = "作业标志";
                        break;
                    case 7:
                        roadSignType = "告示标志";
                        break;
                }
                return roadSignType;
            }
        }, {
            data: "roadSignSecurity",
            render: function (data, type, row) {
                var roadSignSecurity = "安全";
                if (data != 0) {
                    roadSignSecurity = "不安全";
                }
                return roadSignSecurity;
            }
        }, {
            data: "roadSignBug",
            render: function (data, type, row) {
                var roadSignBug = "";
                switch (data) {
                    case 0:
                        roadSignBug = "正常";
                        break;
                    case 1:
                        roadSignBug = "膜脱落";
                        break;
                    case 2:
                        roadSignBug = "膜淡化";
                        break;
                    case 3:
                        roadSignBug = "逆反射系数不达标";
                        break;
                    case 4:
                        roadSignBug = "卷边";
                        break;
                    case 5:
                        roadSignBug = "转向";
                        break;
                    case 6:
                        roadSignBug = "非国际";
                        break;
                    case 7:
                        roadSignBug = "抱箍缺少";
                        break;
                    case 8:
                        roadSignBug = "净空高不达标";
                        break;
                    case 9:
                        roadSignBug = "设置不合理";
                        break;
                    case 10:
                        roadSignBug = "缺失";
                        break;
                    case 11:
                        roadSignBug = "建议增设";
                        break;
                    case 12:
                        roadSignBug = "与交通组织矛盾";
                        break;
                    case 13:
                        roadSignBug = "内容有误";
                        break;
                    case 14:
                        roadSignBug = "标牌与标杆不配套";
                        break;
                    case 15:
                        roadSignBug = "非公指示牌";
                        break;
                }
                return roadSignBug;
            }
        }, {
            data: "roadSignInstallTime"
        }, {
            data: "defectsLiabilityPeriod",
            render: function (data, type) {
                return data + "年";
            }
        }, {
            data: "serviceLife",
            render: function (data, type) {
                return data + "年";
            }
        }, {
            data: "userName"
        }, {
            data: "roadSignId",
            render: function (data, type, row) {
                var buttonOperation = "";
                var buttonUpdate = "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.updateRoadSignCollectModal(" + JSON.stringify(row) + ")' title='编辑'>" +
                    "<i class='fa fa-edit'></i></button>";
                var buttonDelete = "<button class='btn btn-primary btn-xs btn-flat' " +
                    "onclick='$.deleteRoadSignCollect(" + data + ")' title='删除'>" +
                    "<i class='fa fa-minus-square'></i></button>";
                gUpdate == 0 ? buttonOperation : buttonOperation += buttonUpdate + " ";
                gDelete == 0 ? buttonOperation : buttonOperation += buttonDelete;
                buttonOperation == "" ? buttonOperation = "无权限" : buttonOperation;
                return buttonOperation;
            }
        }],
        dom: "<'row'<'col-md-6'><'#modalToolbar.col-md-6'>r>t<'row'>",
        initComplete: function () {
            $("#modalToolbar").empty();
            var strToolBar = "<div class='pull-right'><div class='btn-group'>" +
                "<button type='button' class='btn btn-primary btn-sm btn-flat'><i class='fa fa-cog'></i> 操作</button>" +
                "<button type='button' class='btn btn-primary btn-sm btn-flat dropdown-toggle' " +
                "data-toggle='dropdown' aria-haspopup='true' aria-expanded='false'>" +
                "<span class='caret'></span><span class='sr-only'>切换下拉</span></button>" +
                "<ul class='dropdown-menu'>" +
                "<li>" +
                "<button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='modalDT.ajax.reload(null, false);'><i class='fa fa-refresh'></i> 刷新</button>" +
                "</li>";

            var buttonAdd = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='$.addRoadSignCollectModal()'><i class='fa fa-plus-square'></i> 添加</button></li>";
            gInsert == 0 ? strToolBar : strToolBar += buttonAdd;

            var buttonDelete = "<li><button href='#' class='btn btn-primary btn-sm btn-flat btn-block' " +
                "onclick='$.deleteRoadSignCollect(0)'><i class='fa fa-minus-square'></i> 删除</button></li>";
            gDelete == 0 ? strToolBar : strToolBar += buttonDelete;

            strToolBar += "</ul></div>";
            $("#modalToolbar").append(strToolBar);
        },
        processing: true,
        serverSide: true,
        ordering: false,
        select: false,
        autoFill: true,
        destroy: true,
        displayLength: 20,
        lengthMenu: [[5, 10, 15, 20, 50, 100, 150, -1], [5, 10, 15, 20, 50, 100, 150, "All"]],
        language: {
            url: "zh_cn.json"
        },
        fnDrawCallback: function () {// 序号自增回调函数
            var api = this.api();
            var startIndex = api.context[0]._iDisplayStart;
            api.column(1).nodes().each(function (cell, i) {
                cell.innerHTML = startIndex + i + 1;
            });
        }
    });

    if (gUpdate == 0 && gDelete == 0 && gInsert == 0) {
        var oTable = $('#modalDataTables').dataTable();
        oTable.fnSetColumnVis(0, false);//隐藏列
        oTable.fnSetColumnVis(10, false);
    }

    $("#getRoadSignByRoadPoleIdLabel").text("标牌信息");
    $("#getRoadSignByRoadPoleIdModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

$.closeModal = function () {
    $("#batchCheckModal").prop('checked', false);
    $('#getRoadSignByRoadPoleIdModal').modal('hide');
};

$.checkChangeModal = function () {
    var isChecked = $("#batchCheckModal").prop('checked');
    $("input:checkbox[id^='modalCheckbox']").prop("checked", isChecked);
};

$.updateRoadSignCollectModal = function (jsonData) {
    switchPic = 2;
    roadSignCollectFlag = 0;
    $("#modifierIdModal").val(gUserLoginResult.userId);
    $("#roadSignIdModal").val(jsonData.roadSignId);
    $("#roadSignTypeModal").val(jsonData.roadSignType);
    $("#roadSignBugModal").val(jsonData.roadSignBug);
    $("#roadSignSecurityModal").val(jsonData.roadSignSecurity);
    $("#roadSignShapeModal").val(jsonData.roadSignShape);
    $("#roadSignDirectionModal").val(jsonData.roadSignDirection);
    $("#roadSignMaterialModal").val(jsonData.roadSignMaterial);
    $("#roadSignInstallTypeModal").val(jsonData.roadSignInstallType);
    $("#roadSignFixedModal").val(jsonData.roadSignFixed);
    $("#roadSignLightModal").val(jsonData.roadSignLight);
    $("#roadSignPicModal").attr("src", jsonData.roadSignPic);
    $("#defectsLiabilityPeriodModal").val(jsonData.defectsLiabilityPeriod);
    $("#serviceLifeModal").val(jsonData.serviceLife);
    $("#environmentModal").val(jsonData.environment);
    $("#roadSignRemarkModal").val(jsonData.roadSignRemark);
    $("#installOrgModal").val(jsonData.installOrg);
    $("#roadSignInstallTimeModal").val(jsonData.roadSignInstallTime);
    $("#createUserNameModal").val(jsonData.userName);
    fileUrl = $("#roadSignPicModal").attr("src");
    $.changeRoadSignTypeModal(jsonData.roadSignMeaning);
    $.changeRoadSignSize();
    $("#roadSignSizeModal").val(jsonData.roadSignSize);
    $("#roadSignCollectLabel").text("编辑标牌信息");
    $("#roadSignCollectModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

function myDateFormat(s) {
    return s < 10 ? '0' + s : s;
}

$.addRoadSignCollectModal = function () {
    var myDate = new Date();
    var date = myDate.getFullYear() + "-" + myDateFormat(myDate.getMonth() + 1) + "-" + myDateFormat(myDate.getDate());
    switchPic = 2;
    roadSignCollectFlag = 1;
    $("#roadSignIdModal").val(0);
    $("#createUserIdModal").val(gUserLoginResult.userId);
    $("#orgIdModal").val(gUserLoginResult.orgId);
    $("#roadPoleIdModal").val(roadPoleJsonData.roadPoleId);
    $("#mainOrgIdModal").val(roadPoleJsonData.mainOrgId);
    $("#roadSignTypeModal").val(0);
    $("#roadSignBugModal").val(0);
    $("#roadSignSecurityModal").val(0);
    $("#roadSignShapeModal").val(0);
    $("#roadSignDirectionModal").val(0);
    $("#roadSignMaterialModal").val(0);
    $("#roadSignInstallTypeModal").val(0);
    $("#roadSignFixedModal").val(0);
    $("#roadSignLightModal").val(0);
    $("#roadSignPicModal").attr("src", "../images/default_photo.png");
    $("#roadSignPic").val("../images/default_photo.png");
    $("#defectsLiabilityPeriodModal").val(1);
    $("#serviceLifeModal").val(1);
    $("#environmentModal").val(0);
    $("#roadSignRemarkModal").val("");
    $("#installOrgModal").val("");
    $("#roadSignInstallTimeModal").val(date);
    $("#createUserNameModal").val(gUserLoginResult.userName);
    $("#roadSignRegionId").val(roadPoleJsonData.roadPoleRegionId);
    $.changeRoadSignTypeModal(1);
    $.changeRoadSignSize();
    $("#roadSignCollectLabel").text("添加标牌信息");
    $("#roadSignCollectModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

$.changeRoadSignTypeModal = function (roadSignMeaning) {
    var i;
    $("#roadSignMeaningModal").empty();
    switch ($("#roadSignTypeModal").val()) {
        case '0':
            for (i = 1; i <= 47; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>警 " + i + "</option>");
            break;
        case '1':
            for (i = 1; i <= 48; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>禁 " + i + "</option>");
            break;
        case '2':
            for (i = 1; i <= 36; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>示 " + i + "</option>");
            break;
        case '3':
            for (i = 1; i <= 79; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>路 " + i + "</option>");
            break;
        case '4':
            for (i = 1; i <= 17; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>旅 " + i + "</option>");
            break;
        case '5':
            for (i = 1; i <= 22; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>辅 " + i + "</option>");
            break;
        case '6':
            for (i = 1; i <= 48; i++)
                $("#roadSignMeaningModal").append("<option value='" + i + "'>作 " + i + "</option>");
            break;
        case '7':
            $("#roadSignMeaningModal").append("<option value='1'>无</option>");
            break;
    }
    $("#roadSignMeaningModal").val(roadSignMeaning);
};

$("#roadSignTypeModal").change(function () {
    $.changeRoadSignTypeModal(1);
});


$('#roadSignCollectForm').bootstrapValidator({
    feedbackIcons: {
        valid: 'glyphicon glyphicon-ok',
        invalid: 'glyphicon glyphicon-remove',
        validating: 'glyphicon glyphicon-refresh'
    },
    fields: {
        roadSignType: {
            validators: {
                notEmpty: {message: '标志分类不能为空'}
            }
        },
        roadSignMeaning: {
            validators: {
                notEmpty: {message: '标志含义不能为空'}
            }
        },
        roadSignBug: {
            validators: {
                notEmpty: {message: '存在问题不能为空'}
            }
        },
        roadSignSecurity: {
            validators: {
                notEmpty: {message: '安全状况不能为空'}
            }
        },
        roadSignShape: {
            validators: {
                notEmpty: {message: '标志形状不能为空'}
            }
        },
        roadSignSize: {
            validators: {
                notEmpty: {message: '标牌尺寸不能为空'}
            }
        },
        roadSignMaterial: {
            validators: {
                notEmpty: {message: '标志材料不能为空'}
            }
        },
        roadSignDirection: {
            validators: {
                notEmpty: {message: '标志朝向不能为空'}
            }
        },
        roadSignInstallType: {
            validators: {
                notEmpty: {message: '安装方式不能为空'}
            }
        },
        roadSignFixed: {
            validators: {
                notEmpty: {message: '固定方式不能为空'}
            }
        },
        roadSignLight: {
            validators: {
                notEmpty: {message: '光源显示不能为空'}
            }
        },
        defectsLiabilityPeriod: {
            validators: {
                notEmpty: {message: '保修期不能为空'}
            }
        },
        serviceLife: {
            validators: {
                notEmpty: {message: '使用年限不能为空'}
            }
        },
        environment: {
            validators: {
                notEmpty: {message: '使用场景不能为空'}
            }
        },
        roadSignRemark: {
            validators: {
                stringLength: {max: 200, message: '备注长度不超过200'}
            }
        },
        roadSignInstallTime: {
            validators: {
                stringLength: {max: 25, message: '安装日期长度不超过25'}
            }
        }
    }
}).on('success.form.bv', function (e) {
    e.preventDefault();
    $("#roadSignPic").val(fileUrl);
    var $form = $(e.target);
    var url;
    var formData = $form.serialize();
    if (roadSignCollectFlag == 0) {
        url = "../rds_roadSignManageController/updateRoadSignCollect";
        formData += "&modifierId=" + gUserLoginResult.userId + "";
    } else if (roadSignCollectFlag == 1)
        url = "../rds_roadSignManageController/addRoadSignCollect";
    $.ajax({
        url: url,
        type: 'post',
        data: formData,
        dataType: 'json',
        success: function (msg) {
            if (msg != null && typeof (msg) != "undefined") {
                if (msg.isSuccess == true) {
                    $.alert("数据操作成功", 1);
                    modalDT.ajax.reload(null, false);
                } else {
                    $.alert("数据操作失败", 2);
                }
            } else {
                $.alert('系统错误，请联系管理员', 2);
            }
        },
        error: function () {
            $.alert('系统错误，请联系管理员', 2);
        }
    });
    $.clearModal($("#roadSignCollectForm"), $("#roadSignCollectModal"));
});

$.deleteRoadSignCollect = function (roadSignIds) {
    var count = 1;
    if (roadSignIds == 0) {
        count = $("input:checkbox[id^='modalCheckbox']:checked").length;
        if (count == 0) {
            $.alert("请选择要删除的数据", 2);
            return;
        } else {
            roadSignIds = "";
            $("input:checkbox[id^='modalCheckbox']:checked").each(function () {
                roadSignIds += $(this).val() + ",";
            });
            roadSignIds = roadSignIds.substring(0, roadSignIds.length - 1);
        }
    }
    bootbox.confirm({
        buttons: {
            confirm: {
                label: '<i class="fa fa-check"></i> 确定',
                className: 'btn btn-primary btn-flat'
            },
            cancel: {
                label: '<i class="fa fa-close"></i> 取消',
                className: 'btn btn-warning btn-flat pull-left'
            }
        },
        message: '<i class="fa fa-question-circle-o"></i> <b class="customer-title">确定删除该' + count + '条数据吗?</b>',
        callback: function (result) {
            if (result) {
                $.ajax({
                    url: '../rds_roadSignManageController/deleteRoadSignCollect',
                    type: 'post',
                    dataType: 'json',
                    data: {
                        "roadSignIds": roadSignIds
                    },
                    success: function (msg) {
                        if (msg != null && typeof (msg) != "undefined") {
                            if (msg.isSuccess == true) {
                                $.alert("数据删除成功", 1);
                                modalDT.ajax.reload(null, false);
                            } else {
                                $.alert("数据删除失败", 2);
                            }
                        } else {
                            $.alert('系统错误，请联系管理员', 2);
                        }
                    },
                    error: function () {
                        $.alert('系统错误，请联系管理员', 2);
                    }
                });
            }
        }
    });
};

// 打开上传modal框
$.openUpPic = function () {
    $("#upPictureModal").modal({
        backdrop: 'static',
        keyboard: true,
        show: true
    });
};

// 关闭上传modal框
$.closeUpPhModal = function () {
    $("#upPictureModal").modal("hide");
    $("#ossfile").empty();
    clearOssData();
};

//获取图片信息
$.doneUpPhoto = function () {
    var fileInfo = getOssFileInfo();
    fileUrl = fileInfo[0].fileUrl;
    switch (switchPic) {
        case 0:
            $("#roadPolePicUpdate").attr("src", fileUrl);
            break;
        case 1:
            $("#roadPolePicAdd").attr("src", fileUrl);
            break;
        case 2:
            $("#roadSignPicModal").attr("src", fileUrl);
            break;
    }
    $.closeUpPhModal();
};

//判断文件类型(在需要的js文件添加，文件名务必保持一致)
function judgeFileType(suffix) {
    //图片文件
    if (!(suffix == ".jpg" || suffix == ".JPG" || suffix == ".png" || suffix == ".PNG" ||
        suffix == ".jpeg" || suffix == ".JPEG" || suffix == ".gif" || suffix == ".GIF" ||
        suffix == ".bmp" || suffix == ".BMP")) {
        alert("请选择图片文件！");
        return false;
    }
}

$.showQrcode = function (jsonData) {
    $("#showQrcode").empty();
    var qrcode = new QRCode(document.getElementById("showQrcode"), {
        width: 200,
        height: 200
    });
    qrcode.makeCode("orgId:" + jsonData.orgId + ",roadPoleId:" + jsonData.roadPoleId);

    $("#showQrcodeLabel").text("图片");
    $("#showQrcodeModal").modal({
        backdrop: 'static',
        keyboard: false,
        show: true
    });
};

